import time
import threading

class MyThread(threading.Thread):
    def __init__(self, input, output):
        super(MyThread, self).__init__()
        self.input = input
        self.output = output

    def run(self):
        for line in self.input.readlines():
            time.sleep(1) # 模拟耗时操作
            self.output.write(line)
        print('Thread Done')

def main():
    txt1 = open('1.txt', 'r')
    txt2 = open('2.txt', 'r')
    txt3 = open('3.txt', 'a')
    t1 = MyThread(txt1, txt3)
    t2 = MyThread(txt2, txt3)
    t1.start()
    t2.start()
    t1.join()
    t2.join()
    print('Done')

main()